Engineering a Compiler by Keith D. Cooper & Linda Torczon

Engineering a Compiler by Keith D. Cooper & Linda Torczon

Author:Keith D. Cooper & Linda Torczon
Language: eng
Format: epub, mobi
ISBN: 9780080916613
Publisher: Morgan Kaufmann
Published: 2012-06-12T16:00:00+00:00


where @m is the runtime address of the first element of m, lowi( m) and highi( m) are the lower and upper bounds, respectively, of m's ith dimension, and w is the size of an element of m. The compiler's ability to reduce the cost of that computation depends directly on its analysis of the code and the surrounding context.

If m is a local array with lower bounds of one in each dimension and known upper bounds, then the compiler can simplify the calculation to

where hw is high1( m) × w. If the reference occurs inside a loop where j runs from 1 to k, the compiler might use operator strength reduction to replace the term ( j − 1) × hw with a sequence j1′, j2′, j3′, … jk′, where j1′ = (1 − 1) × hw = 0 and ji′ = ji − 1′ + hw. If i is also the induction variable of a loop running from 1 to l, then strength reduction can replace ( i − 1) × w with the sequence i1′, i2′, i3′, … il′, where i1′ = 0 and ij′ = ij − 1′ + w. After these changes, the address calculation is just



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.